Skip to content

✨ expose Result<T> as public API#1149

Merged
cowboyd merged 3 commits intothefrontside:v4from
rauhryan:rr/all-settled-898
May 8, 2026
Merged

✨ expose Result<T> as public API#1149
cowboyd merged 3 commits intothefrontside:v4from
rauhryan:rr/all-settled-898

Conversation

@rauhryan
Copy link
Copy Markdown
Contributor

@rauhryan rauhryan commented Apr 9, 2026

Motivation

Result<T>, Ok(), and Err() are already exported from the public module surface, but they are still marked @ignore in the API docs.

This PR makes those APIs explicitly public so follow-on work can reference Result<T> without relying on undocumented types.

Approach

  • remove @ignore from Result<T>, Ok(), and Err()
  • add public API documentation and examples for each
  • leave unbox() internal

This is the base PR for the stacked allSettled() work.

@rauhryan rauhryan force-pushed the rr/all-settled-898 branch from 8a87a15 to e186787 Compare April 9, 2026 09:38
Copy link
Copy Markdown
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I said that we should be perfectly aligned with the JavaScript, but now I'm having second thoughts. The reason is because "fulfilled" and "rejected" are very explicitly Promise nomenclature, and operations are not promises.

Also, we have a Result interface which we use everywhere.

thoughts?

Comment thread docs/spawn.mdx Outdated
Comment thread test/all-settled.test.ts Outdated
Comment thread lib/all-settled.ts Outdated
@taras taras added this to the v4.1 milestone Apr 9, 2026
@joshamaju
Copy link
Copy Markdown
Contributor

I know I said that we should be perfectly aligned with the JavaScript, but now I'm having second thoughts. The reason is because "fulfilled" and "rejected" are very explicitly Promise nomenclature, and operations are not promises.

Also, we have a Result interface which we use everywhere.

thoughts?

If the goal is to reduce friction for newcomers, aligning with familiar JavaScript terminology like "fulfilled" and "rejected" makes sense. Even though operations aren’t Promises, these terms are widely understood and lower the learning curve.

The alternative would require introducing additional abstractions—such as Effection’s box utility or similar constructs from other libraries to achieve the same behavior.

@rauhryan rauhryan force-pushed the rr/all-settled-898 branch from 5915edd to 156db90 Compare April 23, 2026 12:24
@rauhryan rauhryan changed the title ✨ add allSettled() operation congruent with Promise.allSettled() ✨ expose Result<T> as public API Apr 23, 2026
@rauhryan
Copy link
Copy Markdown
Contributor Author

Split this into stacked PRs as requested. This PR is now the base PR for exposing Result<T>, Ok(), and Err() as public API. The stacked allSettled() implementation lives here: rauhryan#1

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/effection@1149

commit: 98c30ba

@rauhryan rauhryan force-pushed the rr/all-settled-898 branch from cf8dd4c to d1f564c Compare May 7, 2026 22:53
@rauhryan rauhryan force-pushed the rr/all-settled-898 branch from d1f564c to 98c30ba Compare May 8, 2026 10:30
@cowboyd cowboyd merged commit 953f1bb into thefrontside:v4 May 8, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants